no_std support for the Transform API (#73)#87
Merged
Conversation
- Introduced `TransformBuilder`, `StatefulTransformBuilder`, and `TransformPipeline` for single-input transforms in `no_std + alloc`. - Moved join fan-in functionality to `aimdb-executor`, allowing runtime-specific implementations for Tokio, Embassy, and WASM. - Created `JoinFanInRuntime`, `JoinQueue`, `JoinSender`, and `JoinReceiver` traits to abstract join queue behavior across runtimes. - Implemented `EmbassyJoinQueue`, `TokioJoinQueue`, and `WasmJoinQueue` for respective adapters, ensuring bounded queue semantics. - Updated `typed_api` to expose `transform_join` for multi-input joins without embedding runtime-specific types in `aimdb-core`. - Added documentation for the new design and usage of the transform API in `no_std` environments.
…nin.rs Co-authored-by: Copilot <copilot@github.com>
- Added a new `DewPoint` contract to derive dew point temperature from `Temperature` and `Humidity` using the Magnus approximation. - Updated the weather mesh demo to configure dew point records in the alpha, beta, and gamma weather stations. - Refactored the `transform_join` logic to utilize the new task model, allowing state to be borrowed across `.await` points without additional allocations. - Enhanced logging to include dew point information during initialization. - Updated documentation to reflect the new `DewPoint` contract and its integration into the weather mesh system.
…nt in weather station demo
… unused input keys
Cover the runtime-agnostic join fan-in (Design 027), the breaking on_triggers task-model handler, and per-adapter join-queue impls across aimdb-core, aimdb-executor, aimdb-codegen, and the Tokio, Embassy, and WASM adapters. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
12 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Implements Design 027 to make the full Transform API (single-input and multi-input transform_join) available on no_std + alloc by moving join fan-in behind runtime-agnostic traits in aimdb-executor, with Tokio/Embassy/WASM adapter implementations, plus updated docs/tests and a DewPoint demo across weather-mesh examples.
Changes:
- Introduces
JoinFanInRuntime/JoinQueue/JoinSender/JoinReceivertraits inaimdb-executorand implements them in Tokio, Embassy, and WASM adapters. - Refactors
aimdb-coretransform implementation intotransform/{mod,single,join}.rs, exposestransform_joinas an inherentRecordRegistrarmethod (alloc-gated), and updates codegen/docs/changelogs accordingly. - Extends weather-mesh demos/contracts with a derived
DewPointrecord usingtransform_join(Tokio + Embassy) and adds join integration tests (Tokio + WASM).
Reviewed changes
Copilot reviewed 41 out of 42 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/weather-mesh-demo/weather-station-gamma/src/main.rs | Adds DewPoint derived record via transform_join; adjusts SPMC consumer counts. |
| examples/weather-mesh-demo/weather-station-gamma/rust-toolchain.toml | Bumps pinned Rust toolchain version for the gamma example. |
| examples/weather-mesh-demo/weather-station-gamma/flash.sh | Adds a probe-rs flashing helper script for the gamma board target. |
| examples/weather-mesh-demo/weather-station-gamma/Cargo.toml | Updates adapter/executor feature wiring for join + task pool sizing. |
| examples/weather-mesh-demo/weather-station-beta/src/main.rs | Adds DewPoint derived record via transform_join and updates log output. |
| examples/weather-mesh-demo/weather-station-alpha/src/main.rs | Adds DewPoint derived record via transform_join and updates log output. |
| examples/weather-mesh-demo/weather-mesh-common/src/lib.rs | Re-exports DewPoint and adds DewPointKey record keys. |
| examples/weather-mesh-demo/weather-mesh-common/src/contracts/mod.rs | Adds dew point contract module and re-export. |
| examples/weather-mesh-demo/weather-mesh-common/src/contracts/dew_point.rs | Introduces DewPoint contract implementing AimDB contract traits. |
| docs/design/027-no-std-transform-api.md | Adds the full design document for no_std transform/join refactor (implemented). |
| docs/design/020-M9-transform-api.md | Updates transform API design doc with runtime-owned fan-in and new join exposure. |
| CHANGELOG.md | Documents the no_std Transform API + handler redesign + demo updates. |
| Cargo.lock | Updates lockfile for new deps/version bumps (e.g., futures-channel, embassy crates). |
| aimdb-wasm-adapter/tests/transform_join_integration_tests.rs | Adds WASM join integration test for multi-input sum scenario. |
| aimdb-wasm-adapter/src/lib.rs | Exposes join_queue module from the WASM adapter. |
| aimdb-wasm-adapter/src/join_queue.rs | Implements WASM JoinFanInRuntime using futures_channel::mpsc. |
| aimdb-wasm-adapter/CHANGELOG.md | Notes addition of WASM join queue + integration test + dep changes. |
| aimdb-wasm-adapter/Cargo.toml | Adds futures-channel and enables required futures-util features. |
| aimdb-tokio-adapter/tests/transform_join_integration_tests.rs | Adds Tokio join integration tests (including backpressure stress test). |
| aimdb-tokio-adapter/src/lib.rs | Exposes join_queue module under tokio-runtime feature. |
| aimdb-tokio-adapter/src/join_queue.rs | Implements Tokio JoinFanInRuntime using bounded tokio::mpsc::channel. |
| aimdb-tokio-adapter/CHANGELOG.md | Notes addition of Tokio join queue + integration tests. |
| aimdb-executor/src/lib.rs | Re-exports new join traits and adds ExecutorError::QueueClosed. |
| aimdb-executor/src/join.rs | Defines runtime-agnostic join fan-in traits. |
| aimdb-executor/CHANGELOG.md | Documents new join fan-in traits and QueueClosed error. |
| aimdb-embassy-adapter/src/lib.rs | Exposes join_queue module and updates buffer_sized consumer counting docs. |
| aimdb-embassy-adapter/src/join_queue.rs | Implements Embassy JoinFanInRuntime using embassy_sync::Channel (+ tests). |
| aimdb-embassy-adapter/src/buffer.rs | Adds defmt diagnostics when SpmcRing subscriber slots are exhausted. |
| aimdb-embassy-adapter/CHANGELOG.md | Notes Embassy join queue + improved diagnostics and dependency changes. |
| aimdb-embassy-adapter/Cargo.toml | Adjusts executor dependency/features; adds dev-dep for host critical-section. |
| aimdb-core/src/typed_api.rs | Makes join transform available under alloc with R: JoinFanInRuntime; adds inherent transform_join. |
| aimdb-core/src/transform/single.rs | Extracts single-input transform pipeline/task runner. |
| aimdb-core/src/transform/mod.rs | New transform module root with shared descriptor and re-exports. |
| aimdb-core/src/transform/join.rs | New runtime-agnostic join implementation with task-model on_triggers. |
| aimdb-core/src/transform.rs | Removes old monolithic transform implementation file. |
| aimdb-core/src/lib.rs | Adjusts alloc gating and re-exports join types under alloc. |
| aimdb-core/src/ext_macros.rs | Removes macro-generated transform_join extension method (now inherent). |
| aimdb-core/src/error.rs | Maps executor QueueClosed into DbError. |
| aimdb-core/CHANGELOG.md | Documents no_std transform support and join handler breaking API change. |
| aimdb-codegen/src/rust.rs | Updates generated join handler stubs and join builder call site to on_triggers. |
| aimdb-codegen/CHANGELOG.md | Notes codegen changes for the new join task model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ts in weather station examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #73. Implements Design 027.
Summary
transform_joinworks onno_std + alloc. Fan-in moved out ofaimdb-coreinto the newJoinFanInRuntime/JoinQueue/JoinSender/JoinReceivertraits inaimdb-executor, with implementations in the Tokio (mpsc::channel, capacity 64), Embassy (embassy_sync::Channel, capacity 8), and WASM (futures_channel::mpsc, capacity 64) adapters.aimdb-coreno longer references Tokio types in the join path.JoinBuilder::with_state(...).on_trigger(Fn(...) -> Pin<Box<dyn Future>>)replaced with task-modelJoinBuilder::on_triggers(FnOnce(JoinEventRx, Producer) -> impl Future). Eliminates per-event heap allocation and lets handler state borrow across.awaitpoints.aimdb-codegenupdated to emit the new stub shape.transform_joinis now an inherent method onRecordRegistrar(gatedfeature = "alloc",R: JoinFanInRuntime) rather than living in the macro-generated extension trait — workaround for rust-lang #48214.transform.rssplit intotransform/{mod,single,join}.rsso thealloc-only join path is cleanly separated from the runtime-agnostic single-input path.SpmcRingsubscriber-slot exhaustion now emits adefmt::error!with explicit guidance: count one slot per.tap(),.link_to(), andtransform_joininput. Thebuffer_sized<CAP, CONSUMERS>doc rewritten to match.DewPointdemo. All three weather stations (alpha, beta, gamma) derive aDewPointrecord fromTemperatureandHumidityviatransform_join, exercising the API on Tokio and Embassy end-to-end.Follow-ups (filed, not in this PR)
embassy-runtime, which transitively pulls inplatform-cortex-m).Producer::produceerrors are silently dropped in Embassy join handlers; observability gap worth a separate design discussion.Test plan
make check(fmt + clippy + std/no_std feature combos + embeddedcargo checkforthumbv7em-none-eabihf+wasm-pack build+cargo deny).wasm-bindgen-test) covers multi-input sum.